From: kfraser@localhost.localdomain Date: Mon, 10 Sep 2007 17:09:38 +0000 (+0100) Subject: x86: Cleanup system restart code, and wait 10ms for APs to offline. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14984^2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=4694a6028ca07e4008a59b02a1d1f0aa9887a00b;p=xen.git x86: Cleanup system restart code, and wait 10ms for APs to offline. Signed-off-by: Joseph Cihula Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/machine_kexec.c b/xen/arch/x86/machine_kexec.c index 8fbd1ab164..5d693a2938 100644 --- a/xen/arch/x86/machine_kexec.c +++ b/xen/arch/x86/machine_kexec.c @@ -82,9 +82,6 @@ static void __machine_reboot_kexec(void *data) smp_send_stop(); - disable_IO_APIC(); - hvm_cpu_down(); - machine_kexec(image); } diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c index 8bc658fa83..7653dce4fd 100644 --- a/xen/arch/x86/shutdown.c +++ b/xen/arch/x86/shutdown.c @@ -216,18 +216,12 @@ void machine_restart(void) safe_halt(); } - /* - * Stop all CPUs and turn off local APICs and the IO-APIC, so - * other OSs see a clean IRQ state. - */ smp_send_stop(); - disable_IO_APIC(); - hvm_cpu_down(); /* Rebooting needs to touch the page at absolute address 0. */ *((unsigned short *)__va(0x472)) = reboot_mode; - if (reboot_thru_bios <= 0) + if ( reboot_thru_bios <= 0 ) { for ( ; ; ) { diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c index 1d83a3aba3..550faf069b 100644 --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -319,23 +319,33 @@ int on_selected_cpus( static void stop_this_cpu (void *dummy) { - cpu_clear(smp_processor_id(), cpu_online_map); - - local_irq_disable(); disable_local_APIC(); hvm_cpu_down(); + cpu_clear(smp_processor_id(), cpu_online_map); + for ( ; ; ) __asm__ __volatile__ ( "hlt" ); } +/* + * Stop all CPUs and turn off local APICs and the IO-APIC, so other OSs see a + * clean IRQ state. + */ void smp_send_stop(void) { - /* Stop all other CPUs in the system. */ + int timeout = 10; + smp_call_function(stop_this_cpu, NULL, 1, 0); + /* Wait 10ms for all other CPUs to go offline. */ + while ( (num_online_cpus() > 1) && (timeout-- > 0) ) + mdelay(1); + local_irq_disable(); disable_local_APIC(); + disable_IO_APIC(); + hvm_cpu_down(); local_irq_enable(); }